// 生成符合图片中颜色配置的模拟数据
import { simpleRandomId } from '$lib/utils/textKit.svelte'
import { httpMethods } from '$lib/const'

import type { BadgeColorType } from 'svelte-5-ui-lib'


export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE';

export interface MockEndpoint {
    id: string;
    method: HttpMethod;
    path: string;
    color: BadgeColorType; // 对应图片中的颜色选项
    rounded?: boolean; // 对应图片中的 "Remove rounded" 选项
}

// mockData.ts

const colorMap: Record<HttpMethod, BadgeColorType> = {
    GET: 'sky',
    POST: 'emerald',
    PUT: 'amber',
    PATCH: 'lime',
    DELETE: 'rose',
    HEAD: 'indigo',
    OPTIONS: 'cyan',
    CONNECT: 'gray',
    TRACE: 'purple'
};

export const mockEndpoints: MockEndpoint[] = Array.from({ length: 50 }, (_, i) => {
    const method = httpMethods[Math.floor(Math.random() * httpMethods.length)];
    return {
        id: simpleRandomId(),
        method,
        path: '/api/v1/query/names'.repeat(3),
        color: colorMap[method],
        // rounded: Math.random() > 0.5 // 50%概率显示圆角
    };
});
